/* $RCSFile: Crm3SdkHelpers.cs $
 * Apache license v2 2011 by Christian Surieux
 * $Source: ?/CRMWrapper3/Crm3SdkHelpers.cs $
 * $log$
 * Revision 6 2010/08/06 19:56:31  christian.surieux
 *   Added Log to All cs files
 */

using System;
using System.Diagnostics;
using System.Net;
using System.Collections.Generic;
using System.Text;
using AddonNice.CRMWrapper.CRM3Server;
using AddonNice.CRMWrapper.CRM3Meta;


namespace CrmSdk.CRM3
{
	
	public class CrmTypes
	{
		private static DateTime _minDateTime = new System.DateTime(1900, 1, 1);
		private static DateTime _maxDateTime = new System.DateTime(9999, 12, 30, 23, 59, 59);
		private CrmTypes()
		{
		}
		public static DateTime MinDateTime
		{
			get
			{
				return _minDateTime;
			}
		}
		public static DateTime MaxDateTime
		{
			get
			{
				return _maxDateTime;
			}
		}
		public static CrmBoolean CreateCrmBoolean(Boolean value)
		{
			CrmBoolean result = new CrmBoolean();
			result.Value = value;
			return result;
		}
		public static CrmBooleanProperty CreateCrmBooleanProperty(String name, CrmBoolean value)
		{
			CrmBooleanProperty result = new CrmBooleanProperty();
			result.Name = name;
			result.Value = value;
			return result;
		}
		public static CrmDateTime CreateCrmDateTime(String value)
		{
			CrmDateTime result = new CrmDateTime();
			result.Value = value;
			return result;
		}
		public static CrmDateTimeProperty CreateCrmDateTimeProperty(String name, CrmDateTime value)
		{
			CrmDateTimeProperty result  =   new CrmDateTimeProperty();
			result.Name                 =   name;
			result.Value                =   value;
			return result;
		}
		public static CrmDecimal CreateCrmDecimal(Decimal value)
		{
			CrmDecimal result           =   new CrmDecimal();
			result.Value                =   value;
			return result;
		}
		public static CrmDecimalProperty CreateCrmDecimalProperty(String name, CrmDecimal value)
		{
			CrmDecimalProperty result   =   new CrmDecimalProperty();
			result.Name                 =   name;
			result.Value                =   value;
			return result;
		}
		public static CrmFloat CreateCrmFloat(double value)
		{
			CrmFloat result             =   new CrmFloat();
			result.Value                =   (float)value;
			return result;
		}
		public static CrmFloat CreateCrmFloat(float value)
		{
			CrmFloat result             =   new CrmFloat();
			result.Value                =   value;
			return result;
		}
		public static CrmFloatProperty CreateCrmFloatProperty(String name, CrmFloat value)
		{
			CrmFloatProperty result     =   new CrmFloatProperty();
			result.Name                 =   name;
			result.Value                =   value;
			return result;
		}
		public static CrmMoney CreateCrmMoney(Decimal value)
		{
			CrmMoney result             =   new CrmMoney();
			result.Value                =   value;
			return result;
		}
		public static CrmMoneyProperty CreateCrmMoneyProperty(String name, CrmMoney value)
		{
			CrmMoneyProperty result = new CrmMoneyProperty();
			result.Name = name;
			result.Value = value;
			return result;
		}
		public static CrmNumber CreateCrmNumber(Int32 value)
		{
			CrmNumber result = new CrmNumber();
			result.Value = value;
			return result;
		}
		public static CrmNumberProperty CreateCrmNumberProperty(string name, CrmNumber value)
		{
			CrmNumberProperty result = new CrmNumberProperty();
			result.Name = name;
			result.Value = value;
			return result;
		}
		public static Customer CreateCustomer(string type, Guid value)
		{
			Customer result = new Customer();
			result.type = type;
			result.Value = value;
			return result;
		}
		public static CustomerProperty CreateCustomerProperty(string name, Customer value)
		{
			CustomerProperty result = new CustomerProperty();
			result.Name = name;
			result.Value = value;
			return result;
		}

		public static DynamicEntityArrayProperty CreateDynamicEntityArrayProperty(string name, DynamicEntity[] value)
		{
			DynamicEntityArrayProperty result = new DynamicEntityArrayProperty();
			result.Name = name;
			result.Value = value;
			return result;
		}
		public static EntityNameReference CreateEntityNameReference(String value)
		{
			EntityNameReference result = new EntityNameReference();
			result.Value = value;
			return result;
		}
		public static EntityNameReferenceProperty CreateEntityNameReferenceProperty(String name, EntityNameReference value)
		{
			EntityNameReferenceProperty result = new EntityNameReferenceProperty();
			result.Name = name;
			result.Value = value;
			return result;
		}
		public static Key CreateKey(Guid value)
		{
			Key result = new Key();
			result.Value = value;
			return result;
		}
		public static KeyProperty CreateKeyProperty(String name, Key value)
		{
			KeyProperty result = new KeyProperty();
			result.Name = name;
			result.Value = value;
			return result;
		}
		public static Lookup CreateLookup(String type, Guid value)
		{
			Lookup result = new Lookup();
			result.type = type;
			result.Value = value;
			return result;
		}
		public static LookupProperty CreateLookupProperty(String name, Lookup value)
		{
			LookupProperty result = new LookupProperty();
			result.Name = name;
			result.Value = value;
			return result;
		}
		public static Owner CreateOwner(String type, Guid value)
		{
			Owner result = new Owner();
			result.type = type;
			result.Value = value;
			return result;
		}
		public static OwnerProperty CreateOwnerProperty(String name, Owner value)
		{
			OwnerProperty result = new OwnerProperty();
			result.Name = name;
			result.Value = value;
			return result;
		}
		public static Picklist CreatePicklist(Int32 value)
		{
			Picklist result = new Picklist();
			result.Value = value;
			return result;
		}
		public static PicklistProperty CreatePicklistProperty(String name, Picklist value)
		{
			PicklistProperty result = new PicklistProperty();
			result.Name = name;
			result.Value = value;
			return result;
		}
		public static StateProperty CreateStateProperty(String name, String value)
		{
			StateProperty result = new StateProperty();
			result.Name = name;
			result.Value = value;
			return result;
		}
		public static Status CreateStatus(Int32 value)
		{
			Status result = new Status();
			result.Value = value;
			return result;
		}
		public static StatusProperty CreateStatusProperty(String name, Status value)
		{
			StatusProperty result = new StatusProperty();
			result.Name = name;
			result.Value = value;
			return result;
		}
		public static StringProperty CreateStringProperty(String name, String value)
		{
			StringProperty result = new StringProperty();
			result.Name = name;
			result.Value = value;
			return result;
		}
		public static UniqueIdentifier CreateUniqueIdentifier(Guid value)
		{
			UniqueIdentifier result = new UniqueIdentifier();
			result.Value = value;
			return result;
		}
		public static UniqueIdentifierProperty CreateUniqueIdentifierProperty(String name, UniqueIdentifier value)
		{
			UniqueIdentifierProperty result = new UniqueIdentifierProperty();
			result.Name = name;
			result.Value = value;
			return result;
		}
		public static CrmDateTime CreateCrmDateTimeFromUser(DateTime userTime)
		{
			return CreateCrmDateTime(string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0:s}", userTime));
		}
		public static CrmDateTime CreateCrmDateTimeFromUniversal(DateTime universalTime)
		{
			return CreateCrmDateTime(string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0:s}Z", universalTime));
		}
	}

    public sealed class ActivityPartyType
	{
		public const int Sender = 1;
		public const int ToRecipient = 2;
		public const int CcRecipient = 3;
		public const int BccRecipient = 4;
		public const int Requiredattendee = 5;
		public const int Optionalattendee = 6;
		public const int Organizer = 7;
		public const int Regarding = 8;
		public const int Owner = 9;
		public const int Resource = 10;
		public const int Customer = 11;
		public const int Partner = 12;
	}
	public sealed class AdvancedFindStartupMode
	{
		public const int Simple = 1;
		public const int Detailed = 2;
	}
	public sealed class BulkOperationStatus
	{
		public const int Pending = 1;
		public const int InProgress = 2;
		public const int Aborted = 3;
		public const int Completed = 4;
		public const int Cancelled = 5;
	}
	public sealed class BulkOperationType
	{
		public const int CreateActivities = 2;
		public const int SendDirectMail = 3;
		public const int Propagate = 4;
		public const int Execute = 5;
		public const int BulkImport = 6;
		public const int MiniCampaign = 7;
	}
	public sealed class CampaignActivityChannelType
	{
		public const int Phone = 1;
		public const int Appointment = 2;
		public const int Letter = 3;
		public const int LetterViaMailMerge = 4;
		public const int Fax = 5;
		public const int FaxViaMailMerge = 6;
		public const int Email = 7;
		public const int EmailViaMailMerge = 8;
	}
	public sealed class CampaignResponseChannelType
	{
		public const int Email = 1;
		public const int Phone = 2;
		public const int Fax = 3;
		public const int Letter = 4;
		public const int Appointment = 5;
	}
	public sealed class CascadeOps
	{
		public const int CascadeNone = 0;
		public const int CascadeDeepAll = 2;
	}
	public sealed class ConstraintBasedGroupTypeCode
	{
		public const int Static = 0;
		public const int Dynamic = 1;
		public const int Implicit = 2;
	}
	public sealed class ContractAllotmentTypeCode
	{
		public const int Case = 1;
		public const int Time = 2;
		public const int CoverageDates = 3;
	}
	public sealed class CustomerAddressType
	{
		public const int Account = 1;
		public const int Contact = 2;
	}
	public sealed class DeletionStateCode
	{
		public const int Active = 0;
		public const int SoftDelete = 1;
		public const int HardDelete = 2;
	}
	public sealed class EmailDecisionReason
	{
		public const int Unknown = -1;
		public const int Duplicate = 0;
		public const int NoToken = 1;
		public const int NoTokenMatch = 2;
		public const int TokenMatch = 3;
		public const int NoRecipientMatch = 4;
		public const int InternalEmailReject = 5;
	}
	public sealed class EventDirection
	{
		public const int Incoming = 0;
		public const int Outgoing = 1;
		public const int Internal = 2;
	}
	public sealed class ExtentCode
	{
		public const int Transparent = 0;
		public const int SubtractRecurrenceIntervals = 1;
		public const int SubtractResults = 2;
	}
	public sealed class InheritanceMask
	{
		public const int InheritNone = 0;
		public const int InheritProcesstemplate = 1;
		public const int InheritEmailtemplate = 2;
		public const int InheritReferralsource = 4;
		public const int InheritCompetitor = 8;
		public const int InheritSalesprocess = 16;
		public const int MustInheritProcesstemplate = 32;
		public const int MustInheritEmailtemplate = 64;
		public const int MustInheritReferralsource = 128;
		public const int MustInheritCompetitor = 256;
		public const int MustInheritSalesprocess = 512;
		public const int InheritAll = 1023;
	}
	public sealed class ListType
	{
		public const int Account = 1;
		public const int Contact = 2;
		public const int Lead = 4;
	}
	public sealed class PriceMethod
	{
		public const int CurrencyAmount = 1;
		public const int PercentListPrice = 2;
		public const int MarkupCurrentCost = 3;
		public const int MarginCurrentCost = 4;
		public const int MarkupStandardCost = 5;
		public const int MarginStandardCost = 6;
	}
	public sealed class PricingErrorCode
	{
		public const int None = 0;
		public const int DetailError = 1;
		public const int MissingPriceLevel = 2;
		public const int InactivePriceLevel = 3;
		public const int MissingQuantity = 4;
		public const int MissingUnitPrice = 5;
		public const int MissingProduct = 6;
		public const int InvalidProduct = 7;
		public const int MissingPricingCode = 8;
		public const int InvalidPricingCode = 9;
		public const int MissingUom = 10;
		public const int ProductNotInPriceLevel = 11;
		public const int MissingPriceLevelAmount = 12;
		public const int MissingPriceLevelPercentage = 13;
		public const int MissingPrice = 14;
		public const int MissingCurrentCost = 15;
		public const int MissingStandardCost = 16;
		public const int InvalidPriceLevelAmount = 17;
		public const int InvalidPriceLevelPercentage = 18;
		public const int InvalidPrice = 19;
		public const int InvalidCurrentCost = 20;
		public const int InvalidStandardCost = 21;
		public const int InvalidRoundingPolicy = 22;
		public const int InvalidRoundingOption = 23;
		public const int InvalidRoundingAmount = 24;
		public const int PriceCalculationError = 25;
		public const int InvalidDiscountType = 26;
		public const int DiscountTypeInvalidState = 27;
		public const int InvalidDiscount = 28;
		public const int InvalidQuantity = 29;
		public const int InvalidPricingPrecision = 30;
		public const int MissingProductDefaultuom = 31;
		public const int MissingProductUomschedule = 32;
	}
	public sealed class PriorityCode
	{
		public const int Low = 0;
		public const int Medium = 1;
		public const int High = 2;
	}
	public sealed class QuantitySellingCode
	{
		public const int NoControl = 1;
		public const int Whole = 2;
		public const int WholeAndFraction = 3;
	}
	public sealed class QueueTypeCode
	{
		public const int Public = 1;
		public const int Private = 2;
		public const int Wipbin = 3;
	}
	public sealed class ResponseCode
	{
		public const int Unsubscribe = 0;
		public const int Info = 1;
		public const int Interested = 2;
	}
	public sealed class RoundingOption
	{
		public const int EndsIn = 1;
		public const int MultipleOf = 2;
	}
	public sealed class RoundingPolicy
	{
		public const int None = 1;
		public const int Up = 2;
		public const int Down = 3;
		public const int Nearest = 4;
	}
	public sealed class SavedQueryType
	{
		public const int MainApplicationView = 0;
		public const int AdvancedSearch = 1;
		public const int SubGrid = 2;
		public const int QuickfindSearch = 4;
		public const int Reporting = 8;
		public const int OfflineFilters = 16;
		public const int MaSearch = 32;
		public const int LookupView = 64;
		public const int SmAppointmentbookView = 128;
		public const int OutlookFilters = 256;
	}
	public sealed class TaskStatus
	{
		public const int Null = 0;
		public const int Notstarted = 1;
		public const int Started = 2;
		public const int Inprogress = 3;
		public const int Completed = 4;
		public const int Aborted = 5;
	}
	public sealed class TimeZoneCode
	{
		public const int None = -1;
		public const int DatelineStandardTime = 0;
		public const int SamoaStandardTime = 1;
		public const int HawaiianStandardTime = 2;
		public const int AlaskanStandardTime = 3;
		public const int PacificStandardTime = 4;
		public const int MountainStandardTime = 10;
		public const int MexicoStandardTime2 = 13;
		public const int UsMountainStandardTime = 15;
		public const int CentralStandardTime = 20;
		public const int CanadaCentralStandardTime = 25;
		public const int MexicoStandardTime = 30;
		public const int CentralAmericaStandardTime = 33;
		public const int EasternStandardTime = 35;
		public const int UsEasternStandardTime = 40;
		public const int SaPacificStandardTime = 45;
		public const int AtlanticStandardTime = 50;
		public const int SaWesternStandardTime = 55;
		public const int PacificSaStandardTime = 56;
		public const int NewfoundlandStandardTime = 60;
		public const int EastSouthAmericaStandardTime = 65;
		public const int SaEasternStandardTime = 70;
		public const int GreenlandStandardTime = 73;
		public const int MidAtlanticStandardTime = 75;
		public const int AzoresStandardTime = 80;
		public const int CapeVerdeStandardTime = 83;
		public const int GmtStandardTime = 85;
		public const int GreenwichStandardTime = 90;
		public const int CentralEuropeStandardTime = 95;
		public const int CentralEuropeanStandardTime = 100;
		public const int RomanceStandardTime = 105;
		public const int WestEuropeStandardTime = 110;
		public const int WestCentralAfricaStandardTime = 113;
		public const int EastEuropeStandardTime = 115;
		public const int EgyptStandardTime = 120;
		public const int FleStandardTime = 125;
		public const int GtbStandardTime = 130;
		public const int IsraelStandardTime = 135;
		public const int SouthAfricaStandardTime = 140;
		public const int RussianStandardTime = 145;
		public const int ArabStandardTime = 150;
		public const int EastAfricaStandardTime = 155;
		public const int ArabicStandardTime = 158;
		public const int IranStandardTime = 160;
		public const int ArabianStandardTime = 165;
		public const int CaucasusStandardTime = 170;
		public const int AfghanistanStandardTime = 175;
		public const int EkaterinburgStandardTime = 180;
		public const int WestAsiaStandardTime = 185;
		public const int IndiaStandardTime = 190;
		public const int NepalStandardTime = 193;
		public const int CentralAsiaStandardTime = 195;
		public const int SriLankaStandardTime = 200;
		public const int NorthCentralAsiaStandardTime = 201;
		public const int MyanmarStandardTime = 203;
		public const int SeAsiaStandardTime = 205;
		public const int NorthAsiaStandardTime = 207;
		public const int ChinaStandardTime = 210;
		public const int SingaporeStandardTime = 215;
		public const int TaipeiStandardTime = 220;
		public const int WestAustraliaStandardTime = 225;
		public const int NorthAsiaEastStandardTime = 227;
		public const int KoreaStandardTime = 230;
		public const int TokyoStandardTime = 235;
		public const int YakutskStandardTime = 240;
		public const int AusCentralStandardTime = 245;
		public const int CentralAustraliaStandardTime = 250;
		public const int AusEasternStandardTime = 255;
		public const int EastAustraliaStandardTime = 260;
		public const int TasmaniaStandardTime = 265;
		public const int VladivostokStandardTime = 270;
		public const int WestPacificStandardTime = 275;
		public const int CentralPacificStandardTime = 280;
		public const int FijiStandardTime = 285;
		public const int NewZealandStandardTime = 290;
		public const int TongaStandardTime = 300;
	}
	public sealed class WorkflowProcessType
	{
		public const int None = 0;
		public const int WorkflowProcess = 1;
		public const int ObjectProcess = 2;
		public const int ProcessTemplate = 1000;
		public const int WorkflowProcessTemplate = 1001;
		public const int ObjectProcessTemplate = 1002;
	}
}
